package dataset;

import java.util.Collection;
import java.util.Map;

/**
 * 
 * @author Mark Hoffman
 *
 */

public class DataPoint {

    private static String INITIAL_X = "Date";
    private static String INITIAL_Y = "Open";

    private Map<String, Double> myDataMap;
    private double myXvalue;
    private double myYvalue;
    private Collection<String> myXoptions;
    private Collection<String> myYoptions;


    /**
     * 
     * @param data maps the string identifier with their values
     */
    public DataPoint (Map<String, Double> data) {
        myDataMap = data;
        myXvalue = data.get(INITIAL_X);
        myYvalue = data.get(INITIAL_Y);
        myXoptions = data.keySet();
        myYoptions = data.keySet();
    }

    /**
     * 
     * @return current X Value
     */
    public double getX() {
        return myXvalue;
    }

    /**
     * 
     * @return current Y Value
     */
    public double getY() {
        return myYvalue;
    }

    /**
     * 
     * @return options for the X value
     */
    public Collection<String> getXoptions() {
        return myXoptions;
    }

    /**
     * 
     * @return options for the Y value
     */
    public Collection<String> getYoptions() {
        return myYoptions;
    }

    /**
     * 
     * @param xOption the x-axis value to be changed
     */
    public void changeXoption(String xOption) {
        myXvalue = myDataMap.get(xOption);
    }

    /**
     * 
     * @param yOption the y-axis value to be changed
     */
    public void changeYoption(String yOption) {
        myYvalue = myDataMap.get(yOption);
    }
}
